<?php
include_once 'config.php';
if (isset($_REQUEST['file'])) {
	$file_full_name = $_REQUEST['file'];
	if (isset($_REQUEST['update'])) {
		$info = $_REQUEST['info'];
		file_put_contents($file_full_name, $info);
	}
	$contents = '';
	if (is_file($file_full_name)) $contents = file_get_contents($file_full_name);
	echo '<form method="post">';
	echo '<textarea name="info" rows="10" cols="100">' . $contents . '</textarea>';
	echo '<br />';
	echo '<input type="submit" name="update" value="Update" />';
	echo '<form>';
}?>
<hr />
<h2>Format:</h2>
Each info per line<br />
For specific column info: &lt;info_column&gt;-&lt;attribute&gt;[tab]&lt;value&gt;<br />
For all column info: attribute&gt;[tab]&lt;value&gt;
<h3>Description:</h3>
info_column: 
<?php 
foreach ($field_set_2 as $field) {
	echo $field['id'];
	if ($field != end($field_set_2)) echo ', ';
}
?><br />
attribute: color, hightlight, text, url
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
    $("textarea").allowTabChar();
});
(function($) {
    function pasteIntoInput(el, text) {
        el.focus();
        if (typeof el.selectionStart == "number") {
            var val = el.value;
            var selStart = el.selectionStart;
            el.value = val.slice(0, selStart) + text + val.slice(el.selectionEnd);
            el.selectionEnd = el.selectionStart = selStart + text.length;
        } else if (typeof document.selection != "undefined") {
            var textRange = document.selection.createRange();
            textRange.text = text;
            textRange.collapse(false);
            textRange.select();
        }
    }

    function allowTabChar(el) {
        $(el).keydown(function(e) {
            if (e.which == 9) {
                pasteIntoInput(this, "\t");
                return false;
            }
        });

        // For Opera, which only allows suppression of keypress events, not keydown
        $(el).keypress(function(e) {
            if (e.which == 9) {
                return false;
            }
        });
    }

    $.fn.allowTabChar = function() {
        if (this.jquery) {
            this.each(function() {
                if (this.nodeType == 1) {
                    var nodeName = this.nodeName.toLowerCase();
                    if (nodeName == "textarea" || (nodeName == "input" && this.type == "text")) {
                        allowTabChar(this);
                    }
                }
            })
        }
        return this;
    }
})(jQuery);
</script>